<!--
 * @LastEditors: 杜康
 * @LastEditTime: 2021-09-15 17:06:01
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>错误示例</title>
</head>

<body>
  <div id="app">
    <ele></ele>
  </div>
  <script src="https://unpkg.com/vue/dist/vue.min.js"></script>
  <script>
    // 局部组件生命
    var Child = {
      props: {
        text: {}
      },
      render: function (createElement) {
        return createElement('p', this.text)
      }
    }
    Vue.component('ele', {
      data: function () {
        return {
          text: 'Ele Test'
        }
      },
      render: function (createElement) {
        var _this = this
        // 创建一个子节点，使用组件Child
        var ChildNode = createElement(Child, {
          props: {
            text: this.text
          },
          nativeOn: {
            click: function () {
              _this.text = 'clicked !' + new Date()
            }
          }
        })
        return createElement('div', [
          ChildNode,
          ChildNode
        ])
      }
    })
    var app = new Vue({
      el: '#app'
    })
  </script>
</body>

</html>